﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;
namespace CCF20Model
{
    public interface IEntityWithContext 
    {
        CCF20Entities Context { get; set; } 
    }

    public partial class CCF20Entities 
    {
        partial void OnContextCreated()
        { 
            // set the Context reference whenever an entity is loaded   
            this.ObjectMaterialized += (sender, e) =>
            {
                var entity = e.Entity as IEntityWithContext;
                if (entity != null)
                {
                    entity.Context = this;
                }
            };
        }
    }
}
